<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
 <script>
     function max(arr) {
         let arr2 = arr
         if(arr.length === 2) {
             if(arr[0] > arr[1]) {
                 return arr[0]
             } else {
                 return arr[1]
             }
         }
         arr2.shift()
         let subMax = max(arr2)
         if(arr[0] > subMax) {
             debugger
             return arr[0]
         } else {
             return subMax
         }
     }
     console.log(max([1, 3, 9, 11, 2, 3]));
 </script>   
</body>
</html>